import { BaseWindow } from "../../../component/window/BaseWindow";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { Language } from "../../../../extend/language/Language";
import { ObjCreate } from "../common/ObjCreate";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { PublicMessageConfig } from "../../resource/PublicMessageConfig";
import { SystemSetter } from "../system/SystemSetter";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { CheckBox } from "../../../../fl/controls/CheckBox";
//class GuildwarRule
    
    export  class GuildwarRule extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            titleHeight = 26;
            setSize(333, 328);
            title = Language.getString(41855);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(17, 38, 300, 254, this);
            var loc1=new GTextFormat(FontUtil.songtiName, 12, 11661311);
            loc1.leading = 3;
            this._tfRule = ObjCreate.createTextField("", 24, 48, 290, 245, this, loc1);
            this._tfRule.multiline = true;
            this._tfRule.wordWrap = true;
            this._tfRule.htmlText = PublicMessageConfig.instance.getGuildwarTextByName("guildWarHelpDesc");
            this._cbTodayNoTips = ObjCreate.createCheckBox(Language.getString(41856), 205, 294, 120, 28, this);
            this._cbTodayNoTips.addEventListener(flash.events.Event.CHANGE, this.onChange);
            return;
        }

        /* internal  */onChange(arg1: Object /* flash.events.Event */): void
        {
            SystemSetter.localSetter.setSystemInfo("isTipGuildwarRule", !this._cbTodayNoTips);
            Dispatcher.dispatchEvent(new DataEvent(EventName.Sys_SaveInfoNotShowInWindow));
            return;
        }

        public static get instance(): GuildwarRule
        {
            if (!GuildwarRule._instance) 
            {
                GuildwarRule._instance = new GuildwarRule();
            }
            return GuildwarRule._instance;
        }

        /* internal */ /* var */_cbTodayNoTips: CheckBox;

        /* internal */ /* var */_tfRule: Object /* flash.text.TextField */;

        /* internal */ static /* var */_instance: GuildwarRule;
    }
